mystr = 'hello world and itcast and itheima and Python'

# 1、isalpha(): 字符串不为空而且全部是字母，则返回True，否则返回False
mystr1 = 'hello'
mystr2 = 'hello1234'
print(mystr1.isalpha())  # True
print(mystr2.isalpha())  # False
print('张三a'.isalpha())  # True，汉字也可
print('==========')

# 2、isdigit(): 字符串全部是数字，则返回True，否则返回False
mystr1 = "aaa12345"
mystr2 = '12345'
print(mystr1.isdigit())  # False
print(mystr2.isdigit())  # True
print('==========')

# 3、isalnum: 字符串不为空，并且全部是数字或者字母，则返回True，否则返回False
mystr1 = 'aaa12345'
mystr2 = '12345-'
print(mystr1.isalnum())  # True
print(mystr2.isalnum())  # False
print('==========')

# 4、isspace(): 如果字符串只包含空白，则返回True，否则返回False
mystr1 = '1 2 3 4 5'
mystr2 = '     '
print(mystr1.isspace())  # False
print(mystr2.isspace())  # True
print('\t'.isspace())  # True
print('==========')

# 5、isidentifier(): 判断字符串是不是有效标识符，是返回True，否则返回False
mystr1 = 'abc%'
mystr2 = 'hellopython'
print(mystr1.isidentifier())  # False
print(mystr2.isidentifier())  # True
print('==========')

# 6、isdecimal()：检查字符串是否只包含十进制字符
print('123'.isdecimal())  # True
print('123四'.isdecimal())  # False
print('==========')

# 7、isnumeric()：如果字符串中只包括数字，就返回Ture，否则返回False。
print('123'.isnumeric())  # True
print('123六'.isnumeric())  # True，中文数字也算
print('IIIIIIIV'.isnumeric())  # False，罗马数字不算
